package com.quanyan.user.test;

import com.quanyan.user.model.vo.response.RespMyDynamicImages;
import com.quanyan.user.mq.UserTaskMsg;
import com.quanyan.user.request.ReqUserFollow;
import com.quanyan.user.service.NewsImagesService;
import com.quanyan.user.service.UserFollowService;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by Administrator on 2016/11/25.
 */
public class DynamicTets extends BaseTest {


    @Autowired
    private UserFollowService userFollowService;

    @Autowired
    private NewsImagesService newsImagesService;

    @Test
    public void test(){
        UserTaskMsg u = new UserTaskMsg();
        u.setTaskId(1);
        u.setUid(1);
     //   sendMsgService.sendUserTaskMsg(u);
    }


    @Test
    public void  testFollow(){
        ReqUserFollow reqUserFollow = new ReqUserFollow();
        reqUserFollow.setUid(927);
        List<Integer> lst = new ArrayList<>();
        lst.add(930);
        lst.add(676);
        lst.add(691);
        lst.add(805);
        reqUserFollow.setLstFriendUid(lst);
        userFollowService.queryUserFriendService(reqUserFollow);
    }
    @Test
    public void testGroup(){
        Person p1 = new Person("a",10,"男","china");
        Person p2 = new Person("b",11,"女","japan");
        Person p3 = new Person("c",12,"男","japan");
        Person p4 = new Person("d",14,"男","USA");
        Person p5 = new Person("e",14,"女","china");
        List<Person> persons = new ArrayList<>();
        persons.add(p1);
        persons.add(p2);
        persons.add(p3);
        persons.add(p4);
        persons.add(p5);

        Map<String,List<Person>> map = new HashMap<>();
        for (Person p : persons){
            if(map.get(p.getSex()) == null){
                map.put(p.getSex(),new ArrayList<Person>());
            }
        }

        for (Person p : persons){
            if (map.containsKey(p.getSex())){
                map.get(p.getSex()).add(p1);
            }
        }

        System.out.print(map);

    }

    /**
     * 获取我的动态图片信息
     */
    @Test
    public void testMyDynamicImages(){
        RespMyDynamicImages myDynamicImages = newsImagesService.getMyDynamicImages(654,10);
        System.out.print("myDynamicImages");

    }

    @Test
    public void testDynamicOne(){
        newsImagesService.getDynamicImages(33610);
    }

}
